package cn.atzxc.qy.service.impl;

import cn.atzxc.qy.domain.University;
import cn.atzxc.qy.mapper.UniversityMapper;
import cn.atzxc.qy.service.UniversityService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class UniversityServiceImpl implements UniversityService {

    @Autowired
    private UniversityMapper universityMapper;

    //获取所有的学校列表
    @Override
    public List<University> getCollegeList() {
        LambdaQueryWrapper<University> wrapper = new LambdaQueryWrapper<>();
        List<University> universities = universityMapper.selectList(wrapper);
        if (CollectionUtils.isEmpty(universities)) {
            throw new RuntimeException("学校列表为空");
        }
        return universities;
    }
}
